

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.net.SocketException;

public class TxEngine extends Thread
{
	private RouterEngine engine;
	private DatagramSocket sock;
	private Port parent;

	public TxEngine(DatagramSocket ds)
	{
		sock = ds;
	}
	

	public synchronized void transmit(EthernetFrame message)
	{	
		SocketAddress destAddress = sock.getRemoteSocketAddress();

		DatagramPacket sendPacket;
		try {
			sendPacket = new DatagramPacket(message.toByte(), message.toByte().length, destAddress);
			sock.send(sendPacket);
		} catch (SocketException e) {
			
			e.printStackTrace();
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		
		
	}
	
}
